package com.adjy.pathbuilders.profile;

import android.graphics.Bitmap;

public class Player {
	
	private Bitmap picture;
	
	private String firstName;
	private String lastName;
	private String middleName;
	
	public Player() {
		this("", "", "");
	}
	
	public Player(String firstName, String middleName, String lastName) {
		setFirstName(firstName);
		setLastName(lastName);
		setMiddleName(middleName);
	}
	
	public String getFirstName() {
		return this.firstName;
	}
	
	public void setFirstName(String firstName) {
		firstName = getValidString(firstName);
		this.firstName = firstName;
	}

	private String getValidString(String string) {
		if(string == null){
			string = "";
		}
		return string;
	}
	
	public String getLastName() {
		return this.lastName;
	}
	
	public void setLastName(String lastName) {
		lastName = getValidString(lastName);
		this.lastName = lastName;
	}
	
	public String getMiddleName() {
		return this.middleName;
	}
	
	public void setMiddleName(String middleName) {
		middleName = getValidString(middleName);
		this.middleName = middleName;
	}
	
	public Bitmap getPicture() {
		return this.picture;
	}
	
	public void setPicture(Bitmap picture) {
		if(picture != null) this.picture = picture;
	}
	
	@Override
	public String toString() {
		return getFullName();
	}

	public String getFullName() {
		String fullName = "";
		String [] names = {this.firstName, this.middleName, this.lastName};
		for (int i = 0; i < names.length; i++) {
			if(!names[i].isEmpty()){
				if(!fullName.isEmpty()){
					fullName += " ";
				}
				fullName += names[i];
			}
		}
		return fullName;
	}

}
